<?php include_once("../../../common/common_setting_unit.php");         // 引入通用的设置文件 ?>
<?php include_once(ROOT_PATH_ . "/controller/common/module/head.php"); // 引入通用的头部 ?>
<?php include_once("../controller/data_list.php");                     // 当前页面的控制器 ?>



<body>

<!--顶部栏-->
<div id="topbar"> <?php include ROOT_PATH_ . '/controller/common/module/topbar.php'; ?></div>

<!--容器-->
<div id="container" class="<? echo $now_extender ?>">

<!--侧边栏-->
<div id="sidebar"><?php include ROOT_PATH_ . '/controller/common/module/sidebar.php'; ?></div>





        <?
        //==============================================================================
        //这里开始才是平常开发需要注重的部分，其余的基本不用理会
        //==============================================================================
        ?>

  
        <div id="content" class="layui-form">

            <!--标题设定-->
            <?php $page_title=$_plate['name'].'列表';?>
            <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>

            <!--搜索框-->
            <?php include 'module/mod-search.php'; ?>


            <!--功能按钮：新增，统计，全选，排序，导出之类的-->
            <?php include 'module/mod-function.php'; ?>



            <!-- 用$now_extender .list_boxe来控制来到确认板块信息显示-->
            <div class="list-box">
     
                    <table class="layui-table layui-form">
                        <colgroup>
                            <col width="20" >
                            <col  >
                            <col  >
                            <col  >
                            <col  >
                            <col  >
                            <col  >
                            <col width="90" >
                            <col  >
                            <col width="250" >
                        </colgroup>
                        <thead>
                        <tr>
                            <th  class="layui-table-cell">
                                <input type="checkbox" lay-skin="primary" lay-filter="check_all_checkbox" id="check_all_checkbox" >
                            </th>
                            <th><div class="els2">标题</div></th>
                            <th><div class="els2">工号</div></th>
                            <th><div class="els2">工龄</div></th>
                            <th><div class="els2">职位</div></th>
                            <th><div class="els2">电话</div></th>
                            <th><div class="els2">状态</div></th>
                            <th><div class="els2">发布状态</div></th>
                            <th><div class="els2">时间</div></th>
                            <th><div class="els2">操作</div></th>

                        </tr>
                        </thead>
                        <tbody>


                        <?php for ($i = 0; $i < $_quantity_per_page; $i++) {?>

                            <tr id="item<? echo $_list[$i]['nid'] ?>">

                                <td id="<? echo $i + 1 + $plate['page_list_num'] * ($nowpageid - 1) ?>" class="layui-table-cell">
                                        <input type="checkbox" name="nid[]" lay-skin="primary" lay-filter="item_checkbox"  value="<? echo $_list[$i]['nid'] ?>">
                                </td>

                                <td><div class="els2"><? echo $_list[$i]['title'] ?></div></td>

                                <td><div class="els2"><? echo $_list[$i]['mid'] ?></div></td>

                                <?
                                //判断离职日期。如果没有离职日期，就取当前日期。
                                if ($_list[$i]['leavedate'] == "0000-00-00 00:00:00") {
                                    $_list[$i]['leavedate'] = date("Y-m-d");
                                }
                                $age = count_period($_list[$i]['applydate'], $_list[$i]['leavedate']);
                                ?>
                                <td><div class="els2"><? echo $age[0] . "年" . $age[1] . "月" . $age[2] . "天"; ?></div></td>
                                <td><? echo $_list[$i]['position'] ?></td>
                                <td><? echo $_list[$i]['phone'] ?></td>
                                <td><? echo $_list[$i]['status'] ?>
                                </td>
                                <td>
                                    <input type="checkbox"  <? if ($_list[$i]['publish'] == "发布") {echo "checked";} ?> lay-skin="switch" value="发布" lay-filter="publish" lay-text="是|否">
                                </td>
                                <td><div class="els2"><? echo $_list[$i]['date'] ?></div></td>
                                <td>


<!--                                    <a href="data_edit.php?--><?// echo $data['url_parameter'] ?><!--&nid=--><?// echo $_list[$i]['nid'] ?><!--"-->
<!--                                       class="layui-btn  layui-btn-sm">-->
<!--                                       <i class="fa fa-bar-chart-o" aria-hidden="true"></i>修改-->
<!--                                    </a>-->

<!--                                    <a href="data_info.php?--><?// echo $data['url_parameter'] ?><!--&nid=--><?// echo $_list[$i]['nid'] ?><!--&nowpageid=--><?// echo $_REQUEST['nowpageid'] ?><!--"-->
<!--                                       class="layui-btn  layui-btn-sm" target="_blank">-->
<!--                                        <i class="fa fa-bar-chart-o" aria-hidden="true"></i>信息-->
<!--                                    </a>-->



                                    <span onclick="window_eject('data_edit_window.php?<? echo $data['url_parameter'] ?>&nid=<? echo $_list[$i]['nid'] ?>')"
                                       class="layui-btn  layui-btn-sm">
                                        <i class="fa fa-bar-chart-o" aria-hidden="true"></i>修改
                                    </span>

                                    <a onclick="window_eject('data_info_window.php?<? echo $data['url_parameter'] ?>&nid=<? echo $_list[$i]['nid'] ?>')"
                                       class="layui-btn  layui-btn-sm">
                                        <i class="fa fa-bar-chart-o" aria-hidden="true"></i>信息
                                    </a>


                                    <span
                                            onclick="deleter(<?php echo $_list[$i]['nid'] ?>,'data_delete_process')"
                                            class="layui-btn layui-btn-sm layui-btn-primary">
                                        <i class="layui-icon">&#xe640;</i>删除
                                    </span>
                                </td>

                                
                            </tr>
                        <?php;} ?>



                        </tbody>
                    </table>


                    <?php //无数据时显示
                    if (count($_list) == 0) { echo "暂无数据"; }
                    ?>



                    <!-- todo 这里需要做0判断-->
                    <!-- 翻页代码-->
                    <?php include 'module/page_numbers.php'; ?>


            </div>
            <!--list-box end-->


        </div>
        <!--content端點01-->
        <?
        //==============================================================================
        //这里上面才是平常开发需要注重的部分，下面的基本不用理会，只有底部JS部分需要根据实际情况去加载
        //==============================================================================
        ?>





<br class="clearfloat"/>
<!--container-->
</div>




<!--底部栏-->
<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>


<!--载入删除功能-->
<script type="text/javascript" src="/controller/common/asset/js/deleter.js"></script>

<!--载入弹出窗口功能-->
<script type="text/javascript" src="/controller/common/asset/js/window_eject.js"></script>


<!--载入弹checkbox全选功能；在layui内部实现-->
<script type="text/javascript" src="/controller/common/asset/js/check_all_checkbox.js"></script>
<script type="text/javascript" src="/controller/common/asset/js/mulity_delete_button.js"></script>



<script>
    //layui渲染过的元素，需要在这里写函数

    layui.use('form', function(){
        var form = layui.form;

        //layui中，处理checkbox
        check_all_checkbox(form)

        //监控复选框，选择一个就触发删除按钮
        mulity_delete_button(form)


    });
</script>




</body>
</html>
